//////////////////////////////////////////////////////////////////////////
//
// GAM203
// Render parameters container class
// RenderParams.h
// 
// Scott Taylor
// Qantm College
//
//////////////////////////////////////////////////////////////////////////

#ifndef RENDERPARAMS_H
#define RENDERPARAMS_H

#include <d3d9.h>
#include <d3dx9math.h>

#include <vector>

// Temporary structure used to pass around info to Render() calls
class RenderParams
{
public:
	RenderParams() {}
	// Renderer creates this object (on the stack) and passes a reference to Render() calls
	RenderParams(const D3DXMATRIX& a_worldToView, const D3DXMATRIX& a_viewToScreen,
		const D3DXVECTOR3& a_cameraPos, const D3DXCOLOR& a_globalAmbient)
		: m_worldToView(a_worldToView)
		, m_viewToScreen(a_viewToScreen)
		, m_cameraPos(a_cameraPos)
		, m_globalAmbient(a_globalAmbient)
	{}

	// Renderer calls these functions to set up render params
	void AddLight(const D3DLIGHT9* a_pLight) { m_lights.push_back(a_pLight); }

	// Drawable object calls these functions to access data
	const D3DXMATRIX& GetViewMatrix() const { return m_worldToView; }
	const D3DXMATRIX& GetProjMatrix() const { return m_viewToScreen; }
	const D3DXVECTOR3& GetCameraPos() const { return m_cameraPos; }
	const D3DXCOLOR& GetGlobalAmbient() const { return m_globalAmbient; }
	int GetLightCount() const { return m_lights.size(); }
	const D3DLIGHT9* GetLight(int a_index) const { return m_lights[a_index]; }

private:
	const D3DXMATRIX m_worldToView;
	const D3DXMATRIX m_viewToScreen;

	const D3DXVECTOR3 m_cameraPos;

	const D3DXCOLOR m_globalAmbient;

	typedef std::vector<const D3DLIGHT9*> LightList;
	LightList m_lights;
};

#endif  // RENDERPARAMS_H

